package com.hunk.springMvcExercise.web.controller;

import static com.hunk.utils.io.Print.println;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hunk.core.auth.entity.User;

/** json 测试类
 * @author HunkDeng
 *
 */
@Controller
@RequestMapping(value="test/json")
public class JsonController {
	/**获取json测试页面
	 * @return
	 */
	@RequestMapping(value="/index")
	public String index() {
		return "test/json/index";
	}
	
	/**测试返回json数据
	 * @param mm
	 * @return
	 */
	@RequestMapping(value="/login")
	@ResponseBody
	public Object login(@RequestBody User user, ModelMap mm) {
		println(user);
		return user;
	}
	
	/**测试返回json数据
	 * @param mm
	 * @return
	 */
	@RequestMapping(value="/login2")
	@ResponseBody
	public Object login(ModelMap mm) {
		return new User("sss","dddd","dddfff");
	}
	
}
